import { defineStore } from 'pinia';

export const useUserStore = defineStore('counter', {
	state: () => {
		return { 
			user_data: {},
		};
	},
	getters: {
		getUser(state) {
			const localU = uni.getStorageSync('user_data')?uni.getStorageSync('user_data'):{}
			const U = {
				...state.user_data,
				...localU
			}
			return U
		},
	},
	actions: {
		setUser(user_data) {
			if(user_data){
				this.user_data = {...user_data};
				uni.setStorageSync('user_data',this.user_data)
			}
		},
	},
});
